package com.zmj.sy.mom.srv.aps.controller;


import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.shift.*;
import com.zmj.sy.mom.srv.aps.service.ShiftService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

@RequiredArgsConstructor
@Api(tags = "班次管理")
@RestController
@RequestMapping("/shift")
public class ShiftController {

    private final ShiftService shiftService;

    @ApiOperation("1.2.1 添加班次")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody ShiftAddReqVo reqVo) {
        shiftService.add(reqVo);
        return BaseResVo.ok("添加成功");
    }

    @ApiOperation("1.2.2 班次列表")
    @GetMapping("/list")
    public BaseListResVo<ShiftListResVo> list(@Valid ShiftListReqVo reqVo) {
        return shiftService.list(reqVo);
    }

    @ApiOperation("1.2.3 修改班次")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody ShiftEditReqVo reqVo) {
        shiftService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("1.2.4 删除班次")
    @PostMapping("/delete")
    public BaseResVo delete(BaseIdReqVo reqVo) {
        shiftService.delete(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("1.2.5 班次详情")
    @GetMapping("/get")
    public ShiftGetResVo get(BaseIdReqVo reqVo) {
        return shiftService.get(reqVo);
    }

    @ApiOperation("1.2.2 班次列表")
    @GetMapping("/stationList")
    public BaseListResVo<ShiftListResVo> stationList(BaseIdReqVo reqVo) {
        return shiftService.stationList(reqVo);
    }

}
